package org.zephyr.fastboot.controller;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.zephyr.fastboot.model.Result;

import java.net.http.HttpRequest;

/**
 * @Author: ZephyrGao
 * @Date: 2024/6/24 08:45
 * @Description:
 */
@RestController
@RequestMapping("/api")
public class LoginController {

    @PostMapping("/login")
    public Result<String> login(@RequestParam String username, @RequestParam String password, HttpRequest request) {
        System.out.println(username);
        System.out.println(password);
//        if (userAgent != null && userAgent.contains("Mobile")) {
//            // 移动端登录逻辑
//            if ("valid_token".equals(token)) {
//                return Result.success("移动端登录成功");
//            } else {
//                return Result.error("移动端登录失败");
//            }
//        } else {
//            // PC端登录逻辑
//            if ("user".equals(username) && "pass".equals(password)) {
//                return Result.success("PC端登录成功");
//            } else {
//                return Result.error("PC端登录失败");
//            }
//        }
        Result<String> result = new Result<>();
        result.setCode(200);
        result.setMessage("登录成功");
        return result;
    }
}
